import axios from 'axios'

// 登录的
export const getlogin = async (params) => {
  return axios({
    url: 'http://localhost:3000/user2',
    params
  })
}
//注册的
export const getReigist = async (username) => {
  return axios({
    url: 'http://localhost:3000/user2',
    params: {username}
  })
}

export const Reigist = async (data) => {
   try{
     await axios({
      method: 'POST',
      url: 'http://localhost:3000/user2',
      data:{
        ...data,
        caeate:new Date(),
        img:'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=249589786,2941481629&fm=26&gp=0.jpg',
        info:'还未填写个人介绍'
      }
    })
    return {code:200}
   }catch{
    return false
   }
}
// 上传图片
export const changeImg = async (img) => {
  return axios({
    url: 'http://182.92.156.134:8080/upload',
    method:'post',
    data: img
  })
}